import { Component, OnInit } from '@angular/core';
import { ChatBase } from 'src/app/classes/chat-base';
import { MockChatList } from 'src/app/mocks/mock-chat-list';
import { ChatService } from 'src/app/services/chat.service';
import { Router } from '@angular/router';

@Component({
  selector: 'app-chatlist',
  templateUrl: './chatlist.component.html',
  styleUrls: ['./chatlist.component.less']
})
export class ChatlistComponent implements OnInit {
  chats: ChatBase[];

  constructor(private chatService:ChatService, private router: Router) { 
    this.chats = MockChatList;
  }

  ngOnInit() {
  }

  onChatClick(chat: ChatBase){
    this.chatService.chat = chat;
    this.router.navigateByUrl('/chating')
  }
}
